#include <hxcpp.h>

#ifndef INCLUDED_Std
#include <Std.h>
#endif
#ifndef INCLUDED_cpp_CppInt32__
#include <cpp/CppInt32__.h>
#endif
#ifndef INCLUDED_haxe_io_Output
#include <haxe/io/Output.h>
#endif
#ifndef INCLUDED_jax_io_JCloseable
#include <jax/io/JCloseable.h>
#endif
#ifndef INCLUDED_jax_io_JOutputStream
#include <jax/io/JOutputStream.h>
#endif
#ifndef INCLUDED_jax_lang_JAutoClosable
#include <jax/lang/JAutoClosable.h>
#endif
namespace jax{
namespace io{

Void JOutputStream_obj::__construct(::haxe::io::Output ntv)
{
{
	HX_SOURCE_POS("Source/jax/io/JOutputStream.hx",9)
	this->ntv = ntv;
}
;
	return null();
}

JOutputStream_obj::~JOutputStream_obj() { }

Dynamic JOutputStream_obj::__CreateEmpty() { return  new JOutputStream_obj; }
hx::ObjectPtr< JOutputStream_obj > JOutputStream_obj::__new(::haxe::io::Output ntv)
{  hx::ObjectPtr< JOutputStream_obj > result = new JOutputStream_obj();
	result->__construct(ntv);
	return result;}

Dynamic JOutputStream_obj::__Create(hx::DynamicArray inArgs)
{  hx::ObjectPtr< JOutputStream_obj > result = new JOutputStream_obj();
	result->__construct(inArgs[0]);
	return result;}

hx::Object *JOutputStream_obj::__ToInterface(const type_info &inType) {
	if (inType==typeid( ::jax::io::JCloseable_obj)) return operator ::jax::io::JCloseable_obj *();
	if (inType==typeid( ::jax::lang::JAutoClosable_obj)) return operator ::jax::lang::JAutoClosable_obj *();
	return super::__ToInterface(inType);
}

Void JOutputStream_obj::write( Dynamic b,::cpp::CppInt32__ off,::cpp::CppInt32__ len){
{
		HX_SOURCE_PUSH("JOutputStream_obj::write")
		HX_SOURCE_POS("Source/jax/io/JOutputStream.hx",12)
		if ((::Std_obj::is(b,hx::ClassOf< Array<int> >()))){
			HX_SOURCE_POS("Source/jax/io/JOutputStream.hx",14)
			int _g1 = (  (((off == null()))) ? int((int)0) : int(::cpp::CppInt32___obj::toInt(off)) );
			int _g = (  (((len == null()))) ? int(b->__Field(HX_CSTRING("length"),true)) : int(::cpp::CppInt32___obj::toInt(len)) );
			HX_SOURCE_POS("Source/jax/io/JOutputStream.hx",14)
			while(((_g1 < _g))){
				HX_SOURCE_POS("Source/jax/io/JOutputStream.hx",14)
				int i = (_g1)++;
				HX_SOURCE_POS("Source/jax/io/JOutputStream.hx",15)
				this->ntv->writeByte(b->__GetItem(i));
			}
		}
		else{
			HX_SOURCE_POS("Source/jax/io/JOutputStream.hx",17)
			this->ntv->writeByte(::cpp::CppInt32___obj::toInt(b));
		}
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC3(JOutputStream_obj,write,(void))

Void JOutputStream_obj::flush( ){
{
		HX_SOURCE_PUSH("JOutputStream_obj::flush")
		HX_SOURCE_POS("Source/jax/io/JOutputStream.hx",19)
		this->ntv->flush();
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC0(JOutputStream_obj,flush,(void))

Void JOutputStream_obj::close( ){
{
		HX_SOURCE_PUSH("JOutputStream_obj::close")
		HX_SOURCE_POS("Source/jax/io/JOutputStream.hx",22)
		this->ntv->close();
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC0(JOutputStream_obj,close,(void))


JOutputStream_obj::JOutputStream_obj()
{
}

void JOutputStream_obj::__Mark(HX_MARK_PARAMS)
{
	HX_MARK_BEGIN_CLASS(JOutputStream);
	HX_MARK_MEMBER_NAME(ntv,"ntv");
	HX_MARK_END_CLASS();
}

void JOutputStream_obj::__Visit(HX_VISIT_PARAMS)
{
	HX_VISIT_MEMBER_NAME(ntv,"ntv");
}

Dynamic JOutputStream_obj::__Field(const ::String &inName,bool inCallProp)
{
	switch(inName.length) {
	case 3:
		if (HX_FIELD_EQ(inName,"ntv") ) { return ntv; }
		break;
	case 5:
		if (HX_FIELD_EQ(inName,"write") ) { return write_dyn(); }
		if (HX_FIELD_EQ(inName,"flush") ) { return flush_dyn(); }
		if (HX_FIELD_EQ(inName,"close") ) { return close_dyn(); }
	}
	return super::__Field(inName,inCallProp);
}

Dynamic JOutputStream_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
	switch(inName.length) {
	case 3:
		if (HX_FIELD_EQ(inName,"ntv") ) { ntv=inValue.Cast< ::haxe::io::Output >(); return inValue; }
	}
	return super::__SetField(inName,inValue,inCallProp);
}

void JOutputStream_obj::__GetFields(Array< ::String> &outFields)
{
	outFields->push(HX_CSTRING("ntv"));
	super::__GetFields(outFields);
};

static ::String sStaticFields[] = {
	String(null()) };

static ::String sMemberFields[] = {
	HX_CSTRING("ntv"),
	HX_CSTRING("write"),
	HX_CSTRING("flush"),
	HX_CSTRING("close"),
	String(null()) };

static void sMarkStatics(HX_MARK_PARAMS) {
};

static void sVisitStatics(HX_VISIT_PARAMS) {
	HX_VISIT_MEMBER_NAME(JOutputStream_obj::__mClass,"__mClass");
};

Class JOutputStream_obj::__mClass;

void JOutputStream_obj::__register()
{
	Static(__mClass) = hx::RegisterClass(HX_CSTRING("jax.io.JOutputStream"), hx::TCanCast< JOutputStream_obj> ,sStaticFields,sMemberFields,
	&__CreateEmpty, &__Create,
	&super::__SGetClass(), 0, sMarkStatics, sVisitStatics);
}

void JOutputStream_obj::__boot()
{
}

} // end namespace jax
} // end namespace io
